home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Misc
/
InstallerNG
/
developer
/
gui
/
example
/
igui_QueryDisplay.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-10-28
|
3KB
|
104 lines
#include "includes.h"
#include "installergui_data.h"
/********************************************************************
*
* DESCRIPTION
*
* the QUERYDISPLAY function of the InstallerNG (and the original
* installer v44+) calls this function to examine the screen or
* window of the GUI. see the include file libraries/installergui.h
* for more details.
*
* IN: application - pointer to the private application structure
* object - the object to be examined (GUI_QUERYOBJ_SCREEN or
* GUI_QUERYOBJ_WINDOW are the only valid values)
* attribute - the attribute of the object
*
* OUT: the value of the attribute of the examined object
*
*/
/********************************************************************
*
* STATIC
*
*/
/********************************************************************
*
* EXTERN
*
*/
/********************************************************************
*
* PUBLIC
*
*/
/********************************************************************
*
* CODE
*
*/
long __asm igui_QueryDisplay(register __a0 APTR application,
register __d0 long object,
register __d1 long attribute)
{
#ifdef DEBUG
DEBUG_MAKRO
#endif
{
long retval = 0;
struct Application *app = application;
struct Screen *scr;
struct Window *win;
// get the pointers to the structures
GetAttr(MUIA_Window_Screen, app->app_MainWindow, (ULONG *) &scr);
GetAttr(MUIA_Window_Window, app->app_MainWindow, (ULONG *) &win);
// which object (screen or window)
switch (object)
{
// get a screen attribute
case GUI_QUERYOBJ_SCREEN:
{
switch (attribute)
{
case GUI_QUERYATTR_WIDTH: { retval = scr->Width; break; }
case GUI_QUERYATTR_HEIGHT: { retval = scr->Height; break; }
case GUI_QUERYATTR_DEPTH: { retval = scr->BitMap.Depth; break; }
case GUI_QUERYATTR_COLORS: { retval = 1<<(scr->BitMap.Depth); break; }
}
break;
}
// get a window attribute
case GUI_QUERYOBJ_WINDOW:
{
switch (attribute)
{
case GUI_QUERYATTR_WIDTH: { retval = win->Width; break; }
case GUI_QUERYATTR_HEIGHT: { retval = win->Height; break; }
case GUI_QUERYATTR_UPPER: { retval = win->TopEdge - scr->BarHeight - 1; break; }
case GUI_QUERYATTR_LOWER: { retval = scr->Height - (win->TopEdge + win->Height); break; }
case GUI_QUERYATTR_LEFT: { retval = win->LeftEdge; break; }
case GUI_QUERYATTR_RIGHT: { retval = scr->Width - (win->LeftEdge + win->Width); break; }
}
break;
}
}
return (retval);
}
}